<script setup>
import { watchEffect } from "vue";

const props = defineProps({
  list: {
    type: Array,
    default: () => [],
  },
  title:{
    type: String,
    default: '标题',
  },
  imagSrc:{
    type: String,
    default: '',
  }
});
watchEffect(() => {
  console.log(props.list);
});
</script>
<template>
  <div class="main_style h100">
    <div class="head flex align-items-center">
      <div class="head_txt">{{ title }}</div>
      <img class="head_left" src="@/assets/images/left-jt.png" />
    </div>
    <div class="content">
      <el-image class="banner_image" v-if="imagSrc" :src="imagSrc" fit="fill"/>
      <template v-for="(liitem, index) in list" :key="index">
        <img class="activity_first" v-if="liitem.imgList" :src="liitem.imgList" />
        <div
          v-if="liitem.tableData?.length"
          class="menu_list_box grid grid-gap-8"
          :class="
            (liitem.pbradio == 3 && 'grid-template-columns-1') ||
            (liitem.pbradio == 6 && 'grid-template-columns-2') ||
            (liitem.pbradio == 9 && 'grid-template-columns-3')
          "
        >
          <div class="menu_image_box" v-for="item in liitem.tableData" :key="item">
            <div
              class="w100 h100 flex1 relative images"
              :style="{
                fontSize:
                  (liitem.pbradio == 3 && '36px') ||
                  (liitem.pbradio == 6 && '18px') ||
                  (liitem.pbradio == 9 && '14px')
              }"
            >
              <img
                class="w100 h100 flex1 menu_image_box_image"
                src="@/assets/images/yaogui.png"
              />
              <!-- 处方药 -->
              <div class="prescribe">处方药</div>
              <div class="mask">售罄</div>
            </div>

            <div class="menu_title uni-ellipsis-2">
              [恩必普]丁苯酞软胶囊0.1gx24粒/瓶[恩必普]丁苯酞软胶囊0.1gx24粒/瓶
            </div>
            <div
              class="menu_price flex align-items-center justify-content-between"
            >
              <div class="menu_price_txt">￥16.00</div>
              <!-- <img class="menu_price_img" src="@/assets/images/mobile_add.png" /> -->
              <img
                class="menu_price_img"
                src="@/assets/images/mobile_add_active.png"
              />
            </div>
          </div>
        </div>
        <!-- 标题图片 -->
        <!-- <img class="activity_first" src="@/assets/images/activity1.png" /> -->
        <!-- 模块图片 -->
        <template v-if="liitem.selectImgList?.length">
          <img class="activity_image" v-for="(src,srcIndex) in liitem.selectImgList" :key="srcIndex" :src="src" />
        </template>
       
        <!-- 模块视频 -->
        <div class="activty_video relative" v-if="liitem.fileUrl">
          <img class="activity_image" :src="liitem.fileUrl" />
          <img class="mask_play" src="@/assets/images/active_play.png" />
        </div>
      </template>
    </div>
    <div class="footer">
      后台仅展示商品，具体商品活动信息，请以实际展示效果为准
    </div>
  </div>
</template>

<style lang="less" scoped>
.main_style {
  width: 375px;
  border: 1px solid #ddd;
  .head {
    position: relative;
    height: 40px;
    width: 100%;
    background: #fff;
    .head_txt {
      color: #222222;
      text-align: center;
      font-size: 18px;
      font-weight: bold;
      line-height: normal;
      flex: 1;
    }
    .head_left {
      position: absolute;
      height: 20px;
      width: 20px;
      left: 10px;
      top: 25%;
    }
  }
  .content {
    height: calc(100vh - 300px);
    overflow-y: scroll;
    overflow-x: hidden;
    background: #f6f6f6;
    padding: 12px 0;
    .banner_image {
      width: 343px;
      height: 125px;
      border-radius: 8px;
      margin: 0 15px;
    }
    .activity_first {
      width: 100%;
      height: 32px;
      margin: 12px 0 0;
    }
    .menu_list_box {
      margin: 10px 16px 0;
      .menu_image_box {
        background: #fff;
        border-radius: 8px;
        padding: 8px;
        display: flex;
        flex-direction: column;
        // margin-bottom: 8px;
        .images {
          display: flex;
          align-items: center;
          justify-content: center;
        }
        .menu_image_box_image {
          // 要不要设置最大最小
        }
        .prescribe {
          position: absolute;
          left: 0;
          top: 0;
          border-radius: 2px;
          background: #3686fe;
          color: #ffffff;
          font-size: 0.5em;
          font-weight: 400;
          padding: 2px 4px;
        }
        .mask {
          position: absolute;
          border-radius: 50%;
          padding: 0.9em 0.6em;
          color: #ffffff;
          font-size: 1em;
          font-style: normal;
          font-weight: 500;
          line-height: normal;
          background: rgba(0, 0, 0, 0.5);
        }
        .menu_title {
          margin: 8px 0 0;
          color: #33373d;
          font-size: 14px;
          font-style: normal;
          font-weight: bold;
          line-height: normal;
        }
        .menu_price {
          margin: 7px 0 0;
          .menu_price_txt {
            color: #fc584e;
            font-size: 18px;
            font-style: normal;
            font-weight: bold;
            line-height: 18px;
          }
          .menu_price_img {
            width: 18px;
            height: 18px;
          }
        }
      }
    }
    .activity_image {
      width: 343px;
      height: 125px;
      border-radius: 8px;
      margin: 10px 15px 0;
    }
    .activty_video {
      display: flex;
      align-items: center;
      justify-content: center;
      .mask_play {
        width: 60px;
        height: 60px;
        position: absolute;
      }
    }
  }
  .footer {
    width: 375px;
    height: 44px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
    font-size: 12px;
    font-weight: 500;
  }
}
</style>
